﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Data.Linq.Mapping;
using System.ComponentModel;

namespace STS.Model
{
    [Table]
    public class TypLekarza : INotifyPropertyChanged, INotifyPropertyChanging
    {
        private int id;

        [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
        public int Id
        {
            get { return id; }
            set
            {
                if (id != value)
                {
                    NotifyPropertyChanging("Id");
                    id = value;
                    NotifyPropertyChanged("Id");
                }
            }
        }

        private int idTypLekarza;

        [Column]
        public int IdTypLekarza
        {
            get { return idTypLekarza; }
            set
            {
                if (idTypLekarza != value)
                {
                    NotifyPropertyChanging("IdTypLekarza");
                    idTypLekarza = value;
                    NotifyPropertyChanged("IdTypLekarza");
                }
            }
        }

        private string nazwa;

        [Column]
        public string Nazwa
        {
            get { return nazwa; }
            set
            {
                if (nazwa != value)
                {
                    NotifyPropertyChanging("Nazwa");
                    nazwa = value;
                    NotifyPropertyChanged("Nazwa");
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public event PropertyChangingEventHandler PropertyChanging;

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private void NotifyPropertyChanging(string propertyName)
        {
            if (PropertyChanging != null)
            {
                PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
            }
        }

        public override string ToString()
        {
            return String.Format("Id: {0} Nazwa: {1} IdTypLekarza: {2}", Id, Nazwa, IdTypLekarza);
        }
    }
}
